function dR = Rint2(r,H,impossible,Nu,phi,s,inVb)
% Calculate integrand of conditional value term    

% Calculate error term                
err = (r + inVb(1,:,:) - inVb)./repmat(phi,[1,1,Nu]);


% Calculate CDF of error distribution
CDF = [exp(-exp(-err(1:end-1,:,:)));                                        % Type-1 EV errors (hunt options)
       1 - exp(-s.*err(end,:,:))];                                          % Exponential error (no-apply option)
CDF(repmat(impossible,[1,1,Nu])) = 1;

summand = [1./repmat(phi(1:end-1,:),[1,1,Nu]).*exp(-err(1:end-1,:,:)).*repmat(prod(CDF),[H,1,1]);
           s.*exp(-s.*err(end,:,:)).*prod(CDF(1:end-1,:,:))];
summand(repmat(impossible,[1,1,Nu])) = 0;

dR = (r + inVb(1,:,:)).*sum(summand); 